package com.ecco.persistent;

import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "colour", catalog = "ecco_demo", uniqueConstraints = {})

public class Colour implements java.io.Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 5921872613454920704L;
	
	// Fields
	private Integer col_id;
	private String col_name;
	private String avail;
	private Collection<AccObCol> aocRecords;
	
	// Constructors
	public Colour() { 	}
	
	/** minimal constructor */
	public Colour(Integer col_id) {
		this.setCol_id(col_id);
	}
	
	/** full constructor */
	public Colour(Integer col_id, String col_name, String avail) {
		this.setCol_id(col_id);
		this.setCol_name(col_name);
		this.setAvail(avail);
	}

	//	 Property accessors
	@Id
	@GeneratedValue
	@Column(name = "COL_ID")
	public Integer getCol_id() {
		return col_id;
	}
	
	public void setCol_id(Integer col_id) {
		this.col_id = col_id;
	}

	@Column(name = "COL_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 30)
	public String getCol_name() {
		return col_name;
	}

	public void setCol_name(String col_name) {
		this.col_name = col_name;
	}
	
	@Column(name = "AVAIL", unique = false, nullable = true, insertable = true, updatable = true, length = 15)
	public String getAvail() {
		return avail;
	}

	public void setAvail(String avail) {
		this.avail = avail;
	}
	
	@OneToMany(mappedBy="colour",cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public Collection<AccObCol> getAocRecords(){
	return aocRecords;
	}
	
	public void setAocRecords(Collection<AccObCol> aocRecords) {
		this.aocRecords = aocRecords;
	}
	
}